﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using ExamSystem.Mdeol;
using ExamSystem.BLL;
namespace ExamSystem.ht
{
    public partial class TKecheng_Edit : System.Web.UI.Page
    {
        private TkechengBLL tb = new TkechengBLL();
        protected void Page_Load(object sender, EventArgs e)
        {
             if (!Page.IsPostBack)
            {
                int tkcid = int.Parse(Request.QueryString["id"]);
                Tkecheng t = tb.selecttkcid(tkcid);
                if (t != null)
                {
                    this.tkcName.Value= t.TkcName;
                }

            }
        }
        protected void Button1_Click(object sender, EventArgs e)
        {
            //获取数据
            string tkcname = this.tkcName.Value;
            int tkcid = int.Parse(Request.QueryString["id"]); 
            //验证
            if (string.IsNullOrEmpty(tkcname))
            {
                util.FunHelper.LayerAlter(this, "课程名称不能为空");
            }
            Tkecheng t = new Tkecheng(tkcid,tkcname);
            int b = tb.update(t);
            if (b > 0)
            {
                util.FunHelper.LayerAlter(this, "修改成功", "TKecheng_List.aspx");
            }
            else
            {
                util.FunHelper.LayerAlter(this, "修改失败");
            }
            

        }
        protected void onclick(object sender, EventArgs e)
        {
            util.FunHelper.LayerAlter(this, "确定返回吗？", "TKecheng_List.aspx");
        }
    }
}